﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;

namespace School.UserCentents
{
    public partial class SchoolSet : UserCheckPower
    { 
        BLL.Users Users = new BLL.Users();
        BLL.School Sch = new BLL.School();
        protected void Page_Load(object sender, EventArgs e)
        {
            Panel p1 = (Panel)Master.FindControl("Panel1");
            Panel p2 = (Panel)Master.FindControl("Panel2");
            Panel p3 = (Panel)Master.FindControl("Panel3");
            Panel p4 = (Panel)Master.FindControl("Panel4");
            p1.CssClass = "sldmenuoff";
            p2.CssClass = "sldmenuon0";
            p3.CssClass = "sld1";
            p4.CssClass = "sld0";
            p3.Attributes.Add("style", "display: none");
            p4.Attributes.Add("style", "");
            if (!IsPostBack)
            {
                Model.School s = Sch.GetModel(Convert.ToInt32(Users.GetModel(LoginUserId).SchoolID));
                txtName.Text = s.Name;
                txtJianjie.Text = s.Contents;
                txtGongGao.Text = s.GongGao;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Model.School s = Sch.GetModel(Convert.ToInt32(Users.GetModel(LoginUserId).SchoolID));
            s.Name = txtName.Text;
            s.Contents = txtJianjie.Text;
            s.GongGao = txtGongGao.Text;
            Sch.Update(s);
            ScriptHelper.AlertRedirect("修改成功！", "SchoolSet.aspx");
        }
    }
}